<template>
  <div>
    <h1>侦听器</h1>
    <input type="text" v-model="message" />
    <p>{{ message }}</p>
    <button @click="handleClick">点击我</button>
  </div>
</template>
<script setup>
import { ref, watch, watchEffect } from "vue";
const message = ref("");
watch(
  message,
  (newValue, oldValue) => {
    console.log("message 发生了变化");
    console.log("新值：", newValue);
    console.log("旧值：", oldValue);
  },
  { immediate: true }
);
</script>
